import App from './App.vue'
import router from './router'
import piniaPersist from 'pinia-plugin-persist'
import { verifyAuth } from './system-auth'

/**
 * dayjs
 */
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
dayjs.locale('zh-cn')

/**
 * 样式导入
 */
import 'virtual:svg-icons-register'
import '@/styles/element-plus-css-vars.scss'
import 'element-plus/theme-chalk/index.css'
import '@/styles/common.scss'
import '@/styles/reset-mapbox.scss'
import '@/styles/reset-element-plus.scss'
import { ElSelect } from 'element-plus'
import { CaretBottom } from '@element-plus/icons-vue'

/**
 * app设置
 */
const pinia = createPinia()
pinia.use(piniaPersist)
const app = createApp(App)
app.use(router)
app.use(pinia)

/**
 * 加载页面前的校验
 */
verifyAuth().then(() => {
    const pageLoadingEle = document.querySelector('.entry-page-loading')
    if (pageLoadingEle) {
        pageLoadingEle.setAttribute('style', 'display: none;')
    }
    app.mount('#fpi-app')
})


ElSelect.props.suffixIcon.default = CaretBottom